package com.jiaotong.jiaohangweb.config;

import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.baomidou.mybatisplus.extension.plugins.PerformanceInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

/**
 * <P>
 * Mybatis-Plus 配置
 * </p>
 */
@Configuration
public class MybatisPlusConfig {

	/**
	 * 分页插件，自动识别数据库类型
	 */
	@Bean
	public PaginationInterceptor paginationInterceptor() {
		return new PaginationInterceptor();
	}

	/**
	 * 启用性能分析插件
	 */
	@Bean
	public PerformanceInterceptor performanceInterceptor(){
		return new PerformanceInterceptor();
	}

	/**
	 * 数据库sql返回结果和时间打印
	 */
	@Bean
	public ResultSqlInterceptor paginationInterceptor1() {
		return new ResultSqlInterceptor();
	}

	/**
	 * 数据库sql打印
	 */
	@Bean
	public SqlStatementInterceptor paginationInterceptor2() {
		return new SqlStatementInterceptor();
	}
}